
/**
** \file       exec_if.c
**
** \brief      this function execute if rule
**
** \author     Ben M'rad Hanna, Laterem Hamza, Boillot Ulysse, De Olivera
**             Guillaume and Nguyen Viet Dung
**
** \version    0.8
**
** \date       23 November 2010
**
*/

#include "execution.h"

int     exec_if(s_ruleif        *node)
{
  if (node->in_if != NULL)
  {
    if (exec_cmpdlist(node->in_if) == 0)
    {
      if ((node->in_then) != NULL)
      {
        if (exec_cmpdlist(node->in_then) != 0)
          return (1);

        return (0);
      }
    }
    else
    {
      if (node->else_clause != NULL)
      {
        if (exec_else_clause(node->else_clause) != 0)
          return (1);

        return (0);
      }
      else
        return (1);
    }
  }

  return (1);
}

